# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Henrik Grimler <henrik@grimler.se>
pkgname=heimdall
pkgver=2.0.2
pkgrel=0
pkgdesc="Free implementation of Samsung Galaxy devices flashing protocol"
url="https://git.sr.ht/~grimler/Heimdall"
arch="all"
license="MIT"
makedepends="libusb-dev cmake"
source="$pkgname-v$pkgver.tar.gz::https://git.sr.ht/~grimler/Heimdall/archive/v$pkgver.tar.gz
	heimdall_flash_kernel.sh
	heimdall_wait_for_device.sh
	"
options="!check" # No tests
builddir="$srcdir/Heimdall-v$pkgver"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DDISABLE_FRONTEND=ON
	cmake --build build
}

package() {
	cd build
	for i in bin/heimdall "$srcdir"/heimdall_flash_kernel.sh "$srcdir"/heimdall_wait_for_device.sh; do
		install -Dm755 "$i" "$pkgdir"/usr/bin/"${i##*/}"
	done
}

sha512sums="
62849bfe7550214dd774efea65169673fa916f9d204000f793d995aed9def95fcc895c8913cd648f2397ab7fd154257e0394b78c180ed60d043c75858bac7c0a  heimdall-v2.0.2.tar.gz
f2cae8ee8bd598ca7e2ca8ccb01318dc3b7b049f6177e41a1a3b82906de86cae4f789438d9ed319ec06fd957814d59ec8b5a0f0096630cad0f2ef89825d4fd1a  heimdall_flash_kernel.sh
45e742bb3a8c8d0bc6806a4e9f860b04f255cad72a8602c04759178284c66e0a90d3ea22249b5fa69de1dd1d6ecd6221adaa63d611aa20d2a54aa20868e86a9f  heimdall_wait_for_device.sh
"
